package com.io;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;

public class copy_txt {
  public static void main(String[] args)throws Exception {
    //
      copyfile("/Users/edz/Desktop/BY2151-zmq/src/main/java/文稿/test.txt","/Users/edz/Desktop/BY2151-zmq/src/main/java/文稿/poem.txt");
  }
  public static void copyfile(String src,String to) throws Exception{
      BufferedReader bd = null;
      BufferedWriter bw = null;
      try{
          bd = new BufferedReader(new FileReader(src));
          bw = new BufferedWriter(new FileWriter(to));
          String temp = "";
          while((temp = bd.readLine()) != null){
              bw.write(temp);
              bw.newLine();
          }
          bw.flush();
      }finally{
          bw.close();
          bd.close();
      }
  }
}
